<?php
require_once("../../config/config.inc.php");
//$SM->assign("grid",true);

$sAction = fn_getParam("strAction",ACTION_UPDATE);
$sEPID   = $SEC->sCorpCD;
$sUserName     = fn_getParam("strUserName","");
$sTrueName     = fn_getParam("strTrueName","");
$sSex          = fn_getParam("strSex","");
$sRight        = fn_getParam("strRight","");
$sLockStatus   = fn_getParam("strLockStatus","");
$sPetName  = fn_getParam("strPetName","");

$SM->assign("sUserName"   ,$sUserName);
$SM->assign("sTrueName"   ,$sTrueName);
$SM->assign("sSex"        ,$sSex);
$SM->assign("sRight"      ,$sRight);
$SM->assign("sLockStatus" ,$sLockStatus);
$SM->assign("sPetName"    ,$sPetName);

$iPage = fn_getParam("strCurrentPage","1");
$iPageSize = fn_getParam("strPageSize",DEFAULT_PAGESIZE);


////get user info
/****************
$sqlWhere = "WHERE EPID='".$sEPID."' ";
if ($sUserName != "") {
    $sqlWhere.= "AND USERNAME LIKE '%".$sUserName."%' ";
}
if ($sTrueName != "") {
    $sqlWhere.= "AND TRUENAME LIKE '%".$sTrueName."%' ";
}
if ($sPETNAME != "") {
    $sqlWhere.= "AND PETNAME LIKE '%".$sPetName."%' ";
}
if ($sSex != "") {
    $sqlWhere.= "AND SEX='".$sSex."' ";
}
if ($sRight != "") {
    $sqlWhere.= "AND RIGHTLEVEL='".$sRight."' ";
}

$iRowCount = $DB->getFirstField("SELECT COUNT(ID) FROM $TABLE_EP_USER ".$sqlWhere);
$iRowStart = ($iPage - 1)*$iPageSize;
$SM->assign("sPageInfo", fn_getPageInfo($iPage,$iRowCount,$iPageSize));
$SM->assign("iRowStart",$iRowStart);

$sql = "SELECT ID,EPID,USERNAME,TRUENAME,PASSWD,PWDQUESTION,PWDANSWER,PETNAME,HEADIMAGE,";
$sql.= "DEPARTMENT,TITLE,SEX,BIRTHDAY,IDCARD,COUNTRY_ID,PROVINCE_ID,CITY_ID,COUNTY_ID,";
$sql.= "HOMEADDRESS,POSTCODE,HOMEPHONE,MOBILEPHONE,QQNUMB,MSN,EMAIL,RIGHTLEVEL,";
$sql.= "REGDATE,HITS,LOGONNUMB,LASTLOGONDATE,LOCKSTATUS,SECURITY,REMARK ";
$sql.= "FROM $TABLE_EP_USER ".$sqlWhere;
$sql.= " LIMIT $iRowStart,$iPageSize";
$stmt= $DB->query($sql);
$sGrid = "";
while ($row = $DB->fetchRow($stmt)) {
    $sGrid .= "[\"<input type='radio' name='chkEmp' value='".md5($row["USERNAME"])."'>\",\"";
    if ($SEC->sRole == RIGHT_ADMIN) {
        $sGrid .= "<a href='javascript:doubleClickLink();'>".$row["USERNAME"]."</a>\",\"";
    } else {
        $sGrid .= "<a href='javascript:doubleClickLink();'>*****</a>\",\"";
    }
    $sGrid .= $row["TRUENAME"]."\",\"".$row["PETNAME"]."\",\"";
    $sGrid .= ($row["SEX"]=="1"?"男性":"女性")."\",\"";
    $sGrid .= $row["MOBILEPHONE"]."\",\"".$row["QQNUMB"]."\",\"".$row["MSN"]."\",\"";
    $sGrid .= $row["EMAIL"]."\",\"".($row["RIGHTLEVEL"]=='admin'?'管理员':'一般用户')."\",\"";
    $sGrid .= $aLockStatus[$row["LOCKSTATUS"]]."\",\"".md5($row["USERNAME"])."\"],\n";
}
$sGrid = substr($sGrid,0,-2)."\n";
$SM->assign("sGrid",$sGrid);
***********/


$SM->display('task/taskLogList.html');
?>